package utils

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

/**
获取远程内容工具方法
@param url 远程url地址
@return []byte,error  内容,错误
 */
func RemoteContent(url string) ([]byte, error) {
	res, err := http.Get(url)
	if err != nil {
		return nil, fmt.Errorf("get http info error!url:%s \n err:%s", url, err.Error())
	}
	responses, err := ioutil.ReadAll(res.Body)
	if err != nil {
		return nil, fmt.Errorf("readAll response info error!err:%s", err.Error())
	}
	res.Body.Close()

	return responses, nil
}
